#include "SerialExecutable.h"

//#include <base/BaseLog.h>

SerialExecutable::SerialExecutable(QObject * parent)
    : ExecutableSupport(parent ? parent : this)
    , _io_p(0)
{
    //BFUNCTION(qptrdiff(parent));
}

SerialExecutable::SerialExecutable(QIODevice * ioDevice,
                 QObject * parent)
    : ExecutableSupport(parent)
    , _io_p(ioDevice)
    , _stream(_io_p)
{
    //BFUNCTION(qptrdiff(ioDevice), qptrdiff(parent));
}

void SerialExecutable::setDevice(QIODevice * ioDevice)
{
    //BFUNCTION(qptrdiff(ioDevice));
    _io_p = ioDevice;
    _stream.setDevice(_io_p);
}

QIODevice * SerialExecutable::device(void)
{
    return _io_p;
}

QTextStream * SerialExecutable::stream(void)
{
    return &_stream;
}

QString SerialExecutable::readLine(void)
{
    return _stream.readLine();
}

QTextStream & SerialExecutable::writeLine(const QString & string)
{
    return _stream << string.toLatin1() << endl;
}


void SerialExecutable::initialize(void)
{
    //BFUNCTION();
    ExecutableSupport::initialize();
    // do stuff
}

void SerialExecutable::setup(void)
{
    //BFUNCTION();
    ExecutableSupport::setup();
    // do stuff
}

void SerialExecutable::start(void)
{
    //BFUNCTION();
    ExecutableSupport::start();
    // do stuff
}
